<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="UTF-8">
    <title>悦定内容管理系统</title>

    <!--判断是否登陆-->
    <script type="text/javascript" src="../../vendor/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="../../js/config.js"></script>
    <script type="text/javascript" src="../../js/jquerySession.js"></script>
    <script type="text/javascript">
        if($.session.get('token') == null){
            alert("用户未登录！");
            window.location.href = "../../login.html"
        }
    </script>

    <link href="../../css/common.css" rel="stylesheet">
    <link href="../../css/layout.css" rel="stylesheet">
    <link href="../../css/style_fy.css" rel="stylesheet">
    <link rel="stylesheet" href="../../css/layer.css" id="layui_layer_skinlayercss">

    <style type="text/css">
        #thumbnail_list td {
            border-bottom: 1px solid #ccc
        }

        #thumbnail_list td .thumbnails_content {
            width: 300px;
            height: 200px;
            overflow: hidden;
        }

        #thumbnail_list td .thumbnails_content div {
            width: 200px;
            height: 100px;
            overflow: hidden;
            text-align: center
        }

        #thumbnail_list td .thumbnails_content div {
            font-size: 14px !important;
        }

        #thumbnail_list td .thumbnails_content div img {
            width: 200px;
            height: 100px;
        }

    </style>
</head>
<body>
<div class="wrap">
    <!--header-->
    <div class="header">
        <div class="logo"></div>
        <h1 class="logo">
            <a href="#" title="内容管理">
                <img src="../../images/logo.png" title="内容管理" alt="心跳-内容管理">
            </a>
        </h1>
        <div class="menu">
            <ul>

                <li class="">
                    <a href="../user/participant.html">用户</a>
                </li>
                <li class="current">
                    <a href="../app/welcome.html">APP</a>
                </li>
                <li class="">
                    <a href="../match/matches.html">比赛</a>
                </li>
                <li class="">
                    <a href="../finance/ordermanagement_list.html">财务</a>
                </li>
                <li class="">
                    <a href="../message/sendLog.html">短信</a>
                </li>
                <li class="">
                    <a href="../statistics/registeredUsers.html">统计</a>
                </li>

            </ul>
        </div>
        <div class="user">
            <!--导航条-->
            <ul class="user-main">
                <li id="li-1"><img src="../../images/noavator.png" class="herad-img">admin ( admin )<span></span></li>
            </ul>
            <!--隐藏盒子-->
            <div id="box-1" class="hidden-box hidden-loc-index">
                <ul>
                    <li>
                        <a href="thumbnails.html#" data-href="#" class="edit">修改密码</a>
                    </li>
                    <li>
                        <a href="../../logout.html">安全退出</a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <!-- 左则栏-->
    <div class="sidebar-content">
        <ul id="accordion" class="accordion">
            <li class="open">
                <div class="link">
                    <img src="../../images/1.png"><i class="fa"></i>欢迎页面管理<i class="fa fa-chevron-down"></i>
                </div>
                <ul class="submenu" style="display: block">
                    <li><img src="../../images/4.png">
                        <a href="welcome.html">欢迎页面图片管理</a>
                    </li>
                </ul>
            </li>
            <li class="open">
                <div class="link">
                    <img src="../../images/1.png"><i class="fa"></i>协议管理<i class="fa fa-chevron-down"></i>
                </div>
                <ul class="submenu" style="display: block">
                    <li><img src="../../images/4.png">
                        <a href="insurance_protocol.html">保险协议</a>
                    </li>
                    <li><img src="../../images/4.png">
                        <a href="register_protocol.html">注册协议</a>
                    </li>
                </ul>
            </li>
            <li class="open">
                <div class="link">
                    <img src="../../images/1.png"><i class="fa"></i>APP轮播图管理<i class="fa fa-chevron-down"></i>
                </div>
                <ul class="submenu" style="display: block">
                    <li><img src="../../images/4.png">
                        <a href="thumbnails.html">APP轮播图列表</a>
                    </li>
                </ul>
            </li>
            <li class="open">
                <div class="link">
                    <img src="../../images/1.png"><i class="fa"></i>投票管理<i class="fa fa-chevron-down"></i>
                </div>
                <ul class="submenu" style="display: block">
                    <li><img src="../../images/4.png">
                        <a href="votes.html">投票列表</a>
                    </li>
                </ul>
            </li>
            <li class="open">
                <div class="link">
                    <img src="../../images/1.png"><i class="fa"></i>新闻公告<i class="fa fa-chevron-down"></i>
                </div>
                <ul class="submenu" style="display: block">
                    <li><img src="../../images/4.png">
                        <a href="news.html">公告列表</a>
                    </li>
                </ul>
            </li>
            <li class="open">
                <div class="link">
                    <img src="../../images/1.png"><i class="fa"></i>系统设置<i class="fa fa-chevron-down"></i>
                </div>
                <ul class="submenu" style="display: block">
                    <li><img src="../../images/4.png"><a href="autoupdate.html">App更新</a></li>
                </ul>
            </li>
        </ul>
    </div>
    <!--右侧 start-->
    <div class="right-content m_l_250">
        <div id="top-alert" class="fixed alert alert-error" style="display: none;">
            <button class="close fixed" style="margin-top: 4px;">×</button>
            <div class="alert-content">这是内容</div>
        </div>

        <div class="right-warp">
            <div class="content-title">
                <h1>App轮播图列表</h1></div>
            <div class="content-nav">
                <div class="content-btn">
                    <a onclick="add('../T/T_addThumbnail.html','添加轮播图',['770px', '550px'])"
                       class="btn ml17 btn-primary">添加</a>
                </div>
            </div>
            <!--表单开始-->
            <form name="myform" id="myform" action="" method="post">
                <table width="100%" id="mytable" cellspacing="0" class="list-table">
                    <thead>
                    <tr>
                        <th>标题</th>
                        <th>类型</th>
                        <th>内容详情</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody id="thumbnail_list">

                    </tbody>
                </table>
                <div class="fy_box" id="pageGro">
                    <div>
                        <a href="javascript:void(0)" onclick="GoToFirstPage()">
                            <span class="current">首页</span>
                        </a>
                        <a class="prev" href="javascript:void(0)" onclick="GoToPrePage()">上一页</a>
                        <a class="next" href="javascript:void(0)" onclick="GoToNextPage()">下一页</a>
                        <a class="num">
                            <input type="number" name="num"/>
                        </a>
                        <a class="run" href="javascript:void(0)" onclick="GoToAppointPage()">跳转</a>
                        <a class="last" href="javascript:void(0)" onclick="GoToEndPage()">尾页</a>
                        <a class="first" href="javascript:void(0)"></a>
                        <a class="total" href="javascript:void(0)"></a>
                    </div>
                </div>
            </form>
        </div>

    </div>
    <!--右侧 end-->
</div>
<script type="text/javascript" src="../../vendor/layer.js"></script>
<script src="thumbnail.js"></script>
<script type="text/javascript" src="../../js/common.js"></script>
<script type="text/javascript" src="../../js/index.js"></script>
<script src="../../js/font_limit.js"></script>
<script type="text/javascript" src="../../js/Abbreviations.js"></script>
<script type="text/javascript">
    //添加的弹出iframe
    function add(uri, title, area) {
        if (area == 'undefined' || area == undefined)
            area = ['893px', '600px'];
        layer.open({
            type: 2,
            title: title,
            shadeClose: false,
            shade: 0.4,
            maxmin: false, //开启最大化最小化按钮
            area: area,
            content: uri,
            btn: ['确定', '取消'],
            yes: function (index, layero) { //或者使用btn1
                var body = layer.getChildFrame('body', index);
                var thumbnailContent = body.find('#editor_id').val();
                var thumbnailTitle = body.find(".title").val();
                var formData = new FormData();
                formData.append('file', body.find('#doc')[0].files[0]);
                formData.append('title', thumbnailTitle);
                formData.append('content', thumbnailContent);
                $.ajax({
                    type: "POST",
                    url: baseUrl + "/thumbnails",
                    data: formData,
                    processData: false,
                    contentType: false,
                    success: function (json) {
                        if (json.meta.code == "200") {
                            alert("添加成功！");
                            layer.close(index);
                            window.location.reload();
                        }
                    },
                    error: function (data) {
                        alert("error:" + "修改失败，可能未选择文件");
                    }
                });
            },
            cancel: function (index) { //或者使用btn2
                layer.closeAll();
            }
        });
    }

    //询问并进行某个操作
    function confirmurl(uri, msg) {
        layer.confirm(msg, {
            btn: ['确定', '取消'] //按钮
        }, function () {
            var tr = $('#' + uri + '');
            $.ajax({
                type: "GET",
                url: baseUrl + '/articles/' + uri,
                success: function (json) {
                    if (json.meta.code == "200") {
                        alert("删除成功！");
                        tr.remove();
                        layer.closeAll()
                    }
                },
                error: function (data) {
                    alert("error:" + data.responseText);
                }
            });
        }, function () {
        });
    }

    //修改的iframe
    function edit(uri, name, area) {
        if (area == 'undefined' || area == undefined)
            area = ['893px', '600px'];
        layer.open({
            type: 2,
            title: '修改--' + name,
            shadeClose: false,
            shade: 0.4,
            maxmin: false, //开启最大化最小化按钮
            area: area,
            content: uri,
            btn: ['确定', '取消'],
            yes: function (index, layero) { //或者使用btn1
                var id = uri.substring(uri.indexOf("=") + 1);
                var body = layer.getChildFrame('body', index);
                var newsContent = body.find('#editor_id').val();
                var newsTitle = body.find(".title").val();
                var file = body.find('#doc').val();
                var url = baseUrl + "/articles/" + id;
                if (file == null) {
                    $.ajax({
                        type: "POST",
                        url: url,
                        data: {title: newsTitle, content: newsContent},
                        processData: false,
                        contentType: false,
                        success: function (json) {
                            if (json.meta.code == "200") {
                                alert("修改成功!");
                                layer.close(index);
                                window.location.reload();
                            }
                        },
                        error: function (data) {
                            alert("error:" + "修改失败!");
                        }
                    });
                } else {
                    var formData = new FormData();
                    formData.append('file', body.find('#doc')[0].files[0]);
                    formData.append('title', newsTitle);
                    formData.append('content', newsContent);
                    $.ajax({
                        type: "POST",
                        url: url,
                        data: formData,
                        processData: false,
                        contentType: false,
                        success: function (json) {
                            if (json.meta.code == "200") {
                                alert("修改成功!");
                                layer.close(index);
                                window.location.reload();
                            }
                        },
                        error: function (data) {
                            alert("error:" + "修改失败!");
                        }
                    });
                }
            },
            cancel: function (index) { //或者使用btn2
                layer.closeAll();
            }
        });
    }

    function details(url, name, area) {
        if (area == 'undefined' || area == undefined)
            area = ['893px', '600px'];
        layer.open({
            type: 2,
            title: name,
            shadeClose: true,
            shade: 0.4,
            maxmin: false, //开启最大化最小化按钮
            area: area,
            content: url,
            btn: ['知道了']
        });
    }
</script>
</body>
</html>